package com.overlays;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.widget.Toast;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.MapView;
import com.google.android.maps.OverlayItem;

public class LastKnownLocation extends ItemizedOverlay<OverlayItem> {

	private List<OverlayItem> mItemList = new ArrayList<OverlayItem>();
	private Context context;
	private Drawable defaultMarker;

	public LastKnownLocation(Drawable defaultMarker, GeoPoint p, Context _context) {
		super(defaultMarker);
		context = _context;
		this.defaultMarker = defaultMarker;
		mItemList.add(new OverlayItem(p, "Title", "Snippet"));

		populate();

		// TODO Auto-generated constructor stub
	}

	@Override
	protected OverlayItem createItem(int i) {
		// TODO Auto-generated method stub
		return mItemList.get(i);

	}

	@Override
	protected boolean onTap(int i) {
		// final MockContext context = new MockContext();
		Toast.makeText(context, "Last Known Location.",
				Toast.LENGTH_SHORT).show();

		return true;

	}

	@Override
	public int size() {
		return mItemList.size();
	}

	@Override
	public void draw(Canvas canvas, MapView mapView, boolean shadow) {
		super.draw(canvas, mapView, shadow);
		boundCenterBottom(defaultMarker);
	}
	

}
